import { useUserStore } from '~/stores/modules/user';
export default defineNuxtRouteMiddleware(to => {
    // 白名单路由
    const whiteList = ['/login'];
    const userStore = useUserStore();

    const isLogin = userStore.token;
    console.log(isLogin);
    // 如果登录
    if (!isLogin) {
        // 如果没有登录，跳转到登录页面
        if (!whiteList.includes(to.path)) {
            return navigateTo('/login?redirect=' + to.path);
        }
    }
});
